package com.gohome.gohomechat.presenter;

import android.util.Log;

import com.easemob.chat.EMGroup;
import com.gohome.gohomechat.model.AddressModel;
import com.gohome.gohomechat.model.GroupChatModel;
import com.gohome.gohomechat.model.entify.Friend;
import com.gohome.gohomechat.model.entify.Group;
import com.gohome.gohomechat.model.modellistener.AddressModelInterface;
import com.gohome.gohomechat.model.modellistener.GroupChatModelInterface;
import com.gohome.gohomechat.presenter.callback.AddressCallBack;
import com.gohome.gohomechat.presenter.callback.GroupChatCallBack;
import com.gohome.gohomechat.presenter.presenterlistener.AddressPresenterInterface;
import com.gohome.gohomechat.presenter.presenterlistener.GroupChatPresenterInterface;
import com.gohome.gohomechat.ui.viewlistener.AddressViewInterface;
import com.gohome.gohomechat.ui.viewlistener.GroupChatViewInterface;

import java.util.List;

/**
 * Created by dllo on 16/3/1.
 */
public class GroupChatPresenter extends BasePresenter<GroupChatViewInterface> implements GroupChatPresenterInterface {
    private GroupChatViewInterface groupChatViewInterface;
    private GroupChatModelInterface groupChatModelInterface;

    public GroupChatPresenter(GroupChatViewInterface groupChatViewInterface) {
        this.groupChatViewInterface = groupChatViewInterface;
        this.groupChatModelInterface = new GroupChatModel();
    }


    @Override
    public void showAlertDialog() {

    }

    @Override
    public void refreshData() {
        Log.i("wcl", "刷新群组信息");
        groupChatViewInterface.showDialog();
        groupChatModelInterface.refreshData(new GroupChatCallBack() {
            @Override
            public void onsuccess(List<Group> grouplist) {
                Log.i("wcl", "刷新群组信息  成功回调");
                groupChatViewInterface.dismisssDialog();
                groupChatViewInterface.refreshSuccess(grouplist);
            }

            @Override
            public void failed() {
                Log.i("wcl", "刷新群组信息  失败回调");
                groupChatViewInterface.dismisssDialog();
            }
        });
    }
}
